import { Context } from 'egg';

export default function authMiddleWare(): any {
  return async (ctx: Context, next: () => Promise<any>) => {
    await next();
    if (ctx.status === 404 && !ctx.body) {
      ctx.logger.warn('request path not found');
      ctx.body = {
        success: false,
        code: 404,
        message: 'Not Found',
      };
    }
  };
}
